<template>
  <div class="HeaderWrap wrap">
    <div class="left">
      <img src="../assets/img/indexLogo.6f8ac4f0.png" alt="" />
    </div>

    <ul class="nav">
      <li
        :class="{ active: $route.path == '/home' }"
        @click="$router.push('/home')"
      >
        首页
      </li>
      <li
        :class="{ active: $route.path == '/Goods' }"
        @click="$router.push('/Goods')"
      >
        全部商品
      </li>
      <li
        :class="{ active: $route.path == '/user/cart' }"
        @click="$router.push('/user')"
      >
        个人中心
      </li>
      <li
        :class="{ active: $route.path == '/order' }"
        @click="$router.push('/order')"
      >
        我的订单
      </li>
      <li
        :class="{ active: $route.path == '/free' }"
        @click="$router.push('/free')"
      >
        专属福利
      </li>
    </ul>

    <div class="search">
      <input type="text" placeholder="输入关键字" v-model="keyword" />
      <div @click="keyFn">
        <img src="../assets/img/search.png" alt="" />
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      keyword: "",
    };
  },

  methods: {
    keyFn() {
      this.$router.push(`/Goods/?keyword=${this.keyword}`);
      this.keyword = "";
    },
  },
};
</script>

<style lang="less" scoped>
.HeaderWrap {
  display: flex;
  justify-content: space-between;
  height: 118px;
  align-items: center;

  .left {
    margin-top: -20px;
  }
  .nav {
    display: flex;
    width: 500px;
    justify-content: space-between;
    font-size: 16px;
    font-family: SourceHanSansSC;
    font-weight: 500;
    li {
      cursor: pointer;
    }
    .active {
      color: #0a328e;
      font-weight: 700;
    }
  }

  .search {
    display: flex;

    input {
      width: 214px;
      height: 40px;
      border: 1px solid #dedede;
      border-radius: 20px 0px 0px 20px;
      background: none;
      text-indent: 1em;
      box-sizing: border-box;
      outline: none;
    }
    div {
      // display: inline-block;
      width: 50px;
      height: 40px;
      background: #0a328e;
      border-radius: 0px 20px 20px 0px;
      text-align: center;
      line-height: 40px;
      img {
        width: 15px;
        height: 15px;
        margin-left: -3px;
      }
    }
  }
}
</style>